﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using log4net;
using RealState.BLL;

namespace RealState.W.AdminControl
{
    public partial class CategoriesList : System.Web.UI.UserControl
    {
        private CategoriesBLL m_CategoriesBL;
        private CategoryTypesBLL m_CategoriesTypeBL;
        private Categories m_CategoriesDO;
        protected ILog log = LogManager.GetLogger(typeof(CategoriesList));

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack) {
                try
                {
                    m_CategoriesBL = new CategoriesBLL();
                    rptCategories.DataSource = m_CategoriesBL.GetCategoriess();
                    rptCategories.DataBind();
                }
                catch (Exception ex)
                {
                    log.Error(ex.Message);
                }
                finally {
                    m_CategoriesBL = null;
                }    
            
            }
        }

        protected string GetGroup(object obj)
        {
            if (obj.ToString().Equals("1"))
                return "Tin tức báo chí";
            return "Tin đăng mua bán";
        }

        protected string GetStatus(object obj)
        {
            if (obj.ToString().Equals("1"))
                return "Hiển thị";
            return "Ẩn";
        }
    }
}